package com.itheima.map;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import java.util.TreeMap;
import java.util.function.BiConsumer;

/*
map 的第三种遍历方式
foreach
 */
public class Demo05 {

    public static void main(String[] args) {
        Map<String,String> map = new TreeMap<>();
        map.put("马蓉","宋喆");
        map.put("都美竹","吴亦凡");
        map.put("小吉娜","吴亦凡");
        map.put("小璐","PGone");
        map.put("爽子","张恒");

        map.forEach(new BiConsumer<String, String>() {
            @Override
            public void accept(String s, String s2) {
                System.out.println(s+"="+s2);
            }
        });
        map.forEach((k,v)-> System.out.println(k+"==="+v));
        Collection<String> list = new ArrayList<>();
        list.forEach(x-> System.out.println(x));
    }
}
